package hmi;

public class Hmi<Model> {
	private IController<Model>	controller = null;
	private IView<Model>		view = null;
	private Model				model = null;
	
	//
	// Getters
	//
	public IController<Model> getController() {
		return controller;
	}
	public IView<Model> getView() {
		return view;
	}
	public Model getModel() {
		return model;
	}
	
	//
	// Setters
	//
	public void setController(IController<Model> controller) {
		this.controller = controller;
		check();
	}
	public void setView(IView<Model> view) {
		this.view = view;
		check();
	}
	public void setModel(Model model) {
		this.model = model;
	}
	private void check() {
		if (this.controller!=null) {	
			this.controller.setView(this.view);
			this.controller.setModel(this.model);
		}
		if (this.view!=null) {
			this.view.setController(this.controller);
			this.view.setModel(this.model);
		}	
	}

}
